import { CreateRoleDto } from '@app/modules';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsNotEmpty, Length } from 'class-validator';

import { CreateProfileDto } from './create-profile.dto';

export class CreateAccountDto {
  @ApiProperty({ description: '用户名' })
  @Length(5, 20, { message: '用户名应该在5 - 20 位' })
  @IsNotEmpty({ message: '用户名不能为空' })
  username: string;

  @ApiProperty({ description: '密码' })
  @Length(8, 20, { message: '密码应为8-20位' })
  password: string;

  @ApiPropertyOptional({ type: () => CreateProfileDto, description: '个人信息' })
  profile?: CreateProfileDto;

  @ApiPropertyOptional({ type: () => [CreateRoleDto], description: '角色' })
  roles?: CreateRoleDto[];
}
